package model.eval;

import enums.ExtensionEnum;
import enums.FigureEnum;
import enums.TextBundleEnum;
import enums.URLEnum;
import misc.BundlesProvider;

import java.io.Serializable;
import java.util.ResourceBundle;
/*

    This file is part of Logica-Logike.

    Logica-Logike is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation version 3 of the License.

    Logica-Logike is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with Logica-Logike.  If not, see <http://www.gnu.org/licenses/>.

 */
/**
 * Encapsula datos referidos a un silogismo;
 *
 * @author Jose Martin Rozanec;
 */
public class SylogismData implements Serializable {
    private String terminoMayor;
    private String terminoMedio;
    private String terminoMenor;
    private FigureEnum figura;
    private ExtensionEnum premisaMayorExtension;
    private ExtensionEnum premisaMenorExtension;
    private ExtensionEnum conclusionExtension;

    private boolean pideFigura;
    private boolean pideExtension;
    private boolean pideTerminos;

    public String getTerminoMayor() {
        return terminoMayor;
    }

    public void setTerminoMayor(String terminoMayor) {
        this.terminoMayor = terminoMayor;
    }

    public String getTerminoMedio() {
        return terminoMedio;
    }

    public void setTerminoMedio(String terminoMedio) {
        this.terminoMedio = terminoMedio;
    }

    public String getTerminoMenor() {
        return terminoMenor;
    }

    public void setTerminoMenor(String terminoMenor) {
        this.terminoMenor = terminoMenor;
    }

    public FigureEnum getFigura() {
        return figura;
    }

    public void setFigura(FigureEnum figura) {
        this.figura = figura;
    }

    public ExtensionEnum getPremisaMayorExtension() {
        return premisaMayorExtension;
    }

    public void setPremisaMayorExtension(ExtensionEnum premisaMayorExtension) {
        this.premisaMayorExtension = premisaMayorExtension;
    }

    public ExtensionEnum getPremisaMenorExtension() {
        return premisaMenorExtension;
    }

    public void setPremisaMenorExtension(ExtensionEnum premisaMenorExtension) {
        this.premisaMenorExtension = premisaMenorExtension;
    }

    public ExtensionEnum getConclusionExtension() {
        return conclusionExtension;
    }

    public void setConclusionExtension(ExtensionEnum conclusionExtension) {
        this.conclusionExtension = conclusionExtension;
    }

    public String toString() {
        ResourceBundle bundle = BundlesProvider.getBundle(URLEnum.TEXT_BUNDLE);
        StringBuffer buffer = new StringBuffer();
        if (pideFigura) {
            if (getFigura() != null) {
                buffer.append(bundle.getString(TextBundleEnum.FIGURA.toString()) + ": " + FigureEnum.getString(getFigura()) + "\n");
            } else {
                buffer.append(bundle.getString(TextBundleEnum.FIGURA.toString()) + ": " + "\n");
            }
        }
        if (pideExtension) {
            if (getPremisaMayorExtension() != null) {
                buffer.append(bundle.getString(TextBundleEnum.PREMISA_MAYOR.toString()) + ": " + getPremisaMayorExtension() + "\n");
            } else {
                buffer.append(bundle.getString(TextBundleEnum.PREMISA_MAYOR.toString()) + ": " + "\n");
            }
            if (getPremisaMenorExtension() != null) {
                buffer.append(bundle.getString(TextBundleEnum.PREMISA_MENOR.toString()) + ": " + getPremisaMenorExtension() + "\n");
            } else {
                buffer.append(bundle.getString(TextBundleEnum.PREMISA_MENOR.toString()) + ": " + "\n");
            }
            if (getConclusionExtension() != null) {
                buffer.append(bundle.getString(TextBundleEnum.CONCLUSION.toString()) + ": " + getConclusionExtension() + "\n");
            } else {
                buffer.append(bundle.getString(TextBundleEnum.CONCLUSION.toString()) + ": " + "\n");
            }
        }
        if (pideTerminos) {
            if (getTerminoMayor() != null) {
                buffer.append(bundle.getString(TextBundleEnum.TERMINO_MAYOR.toString()) + ": " + getTerminoMayor() + "\n");
            } else {
                buffer.append(bundle.getString(TextBundleEnum.TERMINO_MAYOR.toString()) + ": " + "\n");
            }
            if (getTerminoMedio() != null) {
                buffer.append(bundle.getString(TextBundleEnum.TERMINO_MEDIO.toString()) + ": " + getTerminoMedio() + "\n");
            } else {
                buffer.append(bundle.getString(TextBundleEnum.TERMINO_MEDIO.toString()) + ": " + "\n");
            }
            if (getTerminoMenor() != null) {
                buffer.append(bundle.getString(TextBundleEnum.TERMINO_MENOR.toString()) + ": " + getTerminoMenor() + "\n");
            } else {
                buffer.append(bundle.getString(TextBundleEnum.TERMINO_MENOR.toString()) + ": " + "\n");
            }
        }
        return buffer.toString();
    }

    public void datosExigidos(boolean figura, boolean extension, boolean terminos) {
        pideFigura = figura;
        pideExtension = extension;
        pideTerminos = terminos;
    }

    public void pideFigura(boolean figura) {
        pideFigura = figura;
    }

    public void pideExtension(boolean extension) {
        pideExtension = extension;
    }

    public void pideTerminos(boolean terminos) {
        pideTerminos = terminos;
    }

    public boolean pideFigura() {
        return pideFigura;
    }

    public boolean pideExtension() {
        return pideExtension;
    }

    public boolean pideTerminos() {
        return pideTerminos;
    }
}
